001 /*
002 * Copyright 2005 Stephen McConnell
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
013 * implied.
014 *
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019 package net.dpml.transit.model;
020
021 import java.io.File;
022 import java.rmi.Remote;
023 import java.rmi.RemoteException;
024
025 import net.dpml.lang.UnknownKeyException;
026
027 /**
028 * A CacheModel maintains information about the configuration of the Transit
029 * cache subsystem. Instances of CacheModel shall be supplied to cache handler
030 * implementations as constructor arguments.
031 *
032 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
033 * @version 1.0.2
034 */
035 public interface CacheModel extends Remote
036 {
037 /**
038 * The property key used to identify the cache location when configuring
039 * a transit profile via an authorative url.
040 */
041 static final String CACHE_LOCATION_KEY = "dpml.transit.cache.location";
042
043 /**
044 * The property key used to identify the cache layout model id when configuring
045 * a transit profile via an authorative url.
046 */
047 static final String CACHE_LAYOUT_KEY = "dpml.transit.cache.layout";
048
049 /**
050 * Return the directory path to be used by the cache handler.
051 * @return the cache directory path.
052 * @exception RemoteException if a remote exception occurs
053 */
054 String getCacheDirectoryPath() throws RemoteException;
055
056 /**
057 * Return the directory to be used by the cache handler as the cache directory.
058 * @return the cache directory.
059 * @exception RemoteException if a remote exception occurs
060 */
061 File getCacheDirectory() throws RemoteException;
062
063 /**
064 * Return the array of hosts configured for the cache.
065 * @return the host model array
066 * @exception RemoteException if a remote exception occurs
067 */
068 HostModel[] getHostModels() throws RemoteException;
069
070 /**
071 * Return an identified host model.
072 * @param id the host identifier
073 * @return the host model
074 * @exception UnknownKeyException if the requested host id is unknown
075 * @exception RemoteException if a remote exception occurs
076 */
077 HostModel getHostModel( String id ) throws UnknownKeyException, RemoteException;
078
079 /**
080 * Add a cache listener to the model.
081 * @param listener the listener to add
082 * @exception RemoteException if a remote exception occurs
083 */
084 void addCacheListener( CacheListener listener ) throws RemoteException;
085
086 /**
087 * Remove a cache listener from the model.
088 * @param listener the listener to remove
089 * @exception RemoteException if a remote exception occurs
090 */
091 void removeCacheListener( CacheListener listener ) throws RemoteException;
092
093 /**
094 * Return the cache layout model.
095 * @return the layout model
096 * @exception RemoteException if a remote exception occurs
097 */
098 LayoutModel getLayoutModel() throws RemoteException;
099
100 /**
101 * Return the layout registry model.
102 * @return the layout registry model
103 * @exception RemoteException if a remote exception occurs
104 */
105 LayoutRegistryModel getLayoutRegistryModel() throws RemoteException;
106
107 }